package www.openteam.com.ui;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.getbase.floatingactionbutton.AddFloatingActionButton;
import com.getbase.floatingactionbutton.FloatingActionButton;
import com.getbase.floatingactionbutton.FloatingActionsMenu;

import butterknife.Bind;
import butterknife.ButterKnife;
import www.openteam.com.R;


/**
 * A simple {@link Fragment} subclass.
 */
public class BlankFragment extends Fragment {


    @Bind(R.id.pink_icon)
    FloatingActionButton pinkIcon;
    @Bind(R.id.semi_transparent)
    AddFloatingActionButton semiTransparent;
    @Bind(R.id.setter)
    FloatingActionButton setter;
    @Bind(R.id.normal_plus)
    AddFloatingActionButton normalPlus;
    @Bind(R.id.right_labels)
    FloatingActionsMenu rightLabels;
    @Bind(R.id.action_a)
    FloatingActionButton actionA;
    @Bind(R.id.action_b)
    FloatingActionButton actionB;
    @Bind(R.id.multiple_actions)
    FloatingActionsMenu multipleActions;
    @Bind(R.id.button_remove)
    FloatingActionButton buttonRemove;
    @Bind(R.id.button_gone)
    FloatingActionButton buttonGone;
    @Bind(R.id.action_enable)
    FloatingActionButton actionEnable;
    @Bind(R.id.multiple_actions_down)
    FloatingActionsMenu multipleActionsDown;
    @Bind(R.id.multiple_actions_left)
    FloatingActionsMenu multipleActionsLeft;
    @Bind(R.id.setter_drawable)
    FloatingActionButton setterDrawable;

    public BlankFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_blank, container, false);
        ButterKnife.bind(this, view);
        iniview();
        initListener();
        return view;
    }

    private void iniview() {

        setter.setSize(FloatingActionButton.SIZE_MINI);
        setter.setColorNormalResId(R.color.pink);
        setter.setColorPressedResId(R.color.pink_pressed);
        setter.setIcon(R.drawable.ic_fab_star);
        setter.setStrokeVisible(false);
    }

    private void initListener() {
        pinkIcon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(getContext(), "Clicked pink Floating Action Button", Toast.LENGTH_SHORT).show();
            }
        });

        FloatingActionButton actionC = new FloatingActionButton(getContext());
        actionC.setTitle("Hide/Show Action above");
        actionC.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                actionB.setVisibility(actionB.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
            }
        });

        multipleActions.addButton(actionC);
    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }
}
